<?php
class UserManager extends DataRowManager{
	private $usersettings;
	private $shopmgr;
	private $userdata;

	function __construct($userid){
		$this->usersettings = new DataRowManager("usersettings", $userid);
		$this->shopmgr = new DataRowManager("shops", $userid);
		$this->userdata = new DataRowManager("users", $userid);
	}
	
	function getPassword(){
		return $this->userdata->get('pass');
	}
	function getLoginDate(){
		return $this->userdata->get('logindate');
	}
	function resetLoginDate(){
		$this->userdata->set("logindate", time());
	}
	function getRegDate(){
		return $this->userdata->get('regdate');
	}
	
	
	
	function getSetting($setting){
		return $this->usersettings->get($setting);
	}
	function setSetting($setting, $value){
		$this->usersettings->set($setting, $value);
	}
	
	function getMoney(){
		return floor($this->shopmgr->get('money'));
	}
	function increaseMoney($by){
		$money = $this->shopmgr->get("money");
		$this->shopmgr->set("money", $money+$by);
	}
	function decreaseMoney($by){
		$this->increaseMoney(0-$by);
	}
	
	
	
}
?>